package com.dha.caodangcongnghe;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;

public class TacGia extends ActionBarActivity implements OnClickListener {
	// private QuangCao quangCao;
	private TextView tvEmail, tvsdt;
	private ImageView ivEmail;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.layout_tac_gia);

		tvEmail = (TextView) findViewById(R.id.tvDiaChiEmail);
		ivEmail = (ImageView) findViewById(R.id.ivGmail);

		tvEmail.setOnClickListener(this);
		ivEmail.setOnClickListener(this);

		tvsdt = (TextView) findViewById(R.id.tv_sdt);
		tvsdt.setOnClickListener(this);
		// quangCao = new QuangCao(this, TacGia.this);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.tv_sdt:
			Intent intent2 = new Intent(Intent.ACTION_CALL);
			intent2.setData(Uri.parse("tel:"+tvsdt.getText().toString()));
			startActivity(intent2);
			break;
		case R.id.tvDiaChiEmail:
		case R.id.ivGmail:
			// TODO Auto-generated method stub
			Intent intent = new Intent(Intent.ACTION_VIEW);
			Uri data = Uri.parse("mailto:duonghienan2004@gmail.com?subject="
					+ "Góp ý cho chương trình Cao Đẳng Công Nghệ");
			intent.setData(data);
			startActivity(intent);
			break;
		}
	}

//	@Override
//	public boolean onCreateOptionsMenu(Menu menu) {
//		// Inflate the menu; this adds items to the action bar if it is present.
//		getMenuInflater().inflate(R.menu.menu_goi_email, menu);
//		return super.onCreateOptionsMenu(menu);
//	}
//
//	@Override
//	public boolean onOptionsItemSelected(MenuItem item) {
//		switch (item.getItemId()) {
//		case R.id.mn_GoiEmail:
//			Intent intent = new Intent(Intent.ACTION_VIEW);
//			Uri data = Uri.parse("mailto:duonghienan2004@gmail.com?subject="
//					+ "Góp ý cho chương trình Cao Đẳng Công Nghệ");
//			intent.setData(data);
//			startActivity(intent);
//			break;
//		}
//		return super.onOptionsItemSelected(item);
//	}
}
